<?php

require ("sharedResources.php");

$sid = '';
try {
    // We need a SID (session ID) in order to operate
	$sid = login ( 'admin', 'admin' );
	echo 'sid: ' . $sid . PHP_EOL;
	
	$folderName = "PHP created folder";
	$parentFolder = DEFAULT_WORKSPACE; // create the folder in DEFAULT_WORKSPACE
	$FOLDER_TYPE_DEFAULT = 0; // default folder type
	
	$folder = array ('description' => null, 'id' => 0, 'name' => $folderName, 'parentId' => $parentFolder, 'type' => $FOLDER_TYPE_DEFAULT);
	
	$createFolderParams = array ('sid' => $sid, 'folder' => $folder );
	
	$result = $folderClient->create ( $createFolderParams );
	print_r ( $result );
	
	echo PHP_EOL . 'Folder created with Name: ' . $result->folder->name . '; ID: ' . $result->folder->id;
	//unset ( $folderClient );
} catch ( SoapFault $e ) {
	print_r ( $e );
}

// Always we need to logout in order to release connection slot
logout ( $sid );
?> 
